#include <iostream>
#include "opencv2/opencv.hpp"

using namespace std;
using namespace cv;

// build cmd:
// g++ pic2matrix.cpp -I/usr/local/include/opencv4 -L/usr/local/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core

// how to find opencv lib:
// cd /home/raii/Downloads/opencvbuild
// cmake -DOPENCV_GENERATE_PKGCONFIG=YES ../opencv-4.x/
// cmake --build .
// sudo make install
// and then find in terminal: pkg-cofig --libs --cflags opencv4


int main(int argc, char* argv[])
{
    cout << "hello pic2matrix!~" << endl;
    string picPath = "../doc/data/raw.png";
    Mat img = imread(picPath);
    if (img.empty()) {
        cout << "input pic load failed: " << picPath << endl;
        return -1;
    }
    cout << "input pic load succeed: " << picPath << endl;
    imshow("img", img);
    while (1)
    {
        int k = waitKey(10);
        if (k == 27) {
            exit(0);
        }
    }

    return 0;
}